import { ContainerModule } from '@theia/core/shared/inversify';
import { EcsShellWidget } from './ecs-shell-widget';
import { InstanceWidget } from './instance-widget';
import { EcsShellViewContribution } from './ecs-shell-view-contribution';
import { bindViewContribution, FrontendApplicationContribution, WidgetFactory } from '@theia/core/lib/browser';

export default new ContainerModule(bind => {
    bindViewContribution(bind, EcsShellViewContribution);
    bind(FrontendApplicationContribution).toService(EcsShellViewContribution);
    bind(EcsShellWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: EcsShellWidget.ID,
        createWidget: () => ctx.container.get<EcsShellWidget>(EcsShellWidget)
    })).inSingletonScope();

    bind(InstanceWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: InstanceWidget.ID,
        createWidget: () => ctx.container.get<InstanceWidget>(InstanceWidget)
    }));
});
